<template>
  <div>
    <el-row>
      <el-col :span="24" class="newLogHead">
        <el-col :span="8">名称</el-col>
        <el-col :span="5">事件类型</el-col>
        <el-col :span="11">事件时间</el-col>
      </el-col>
    </el-row>
    <vue-seamless-scroll
      :class-option="defaultOption"
      :data="logList"
      class="newLogBox"
    >
      <el-row
        class="newLogItem"
        v-for="(item, index) in logList"
        :key="index"
        style="cursor: pointer"
      >
        <el-col :span="8">{{ item.address }}</el-col>
        <el-col :span="5" class="logListevent" :title="item.event">{{
          item.event
        }}</el-col>
        <el-col :span="11">{{ item.time }}</el-col>
      </el-row>
    </vue-seamless-scroll>
  </div>
</template>
<script>
import vueSeamlessScroll from "vue-seamless-scroll";
import ajax from "@/utils/ajax";
export default {
  data() {
    return {
      logList: [],
    };
  },
  components: {
    vueSeamlessScroll,
  },
  mounted() {
    this.getlogListData();
  },
  methods: {
    getlogListData() {
      ajax.get({
        url: this.$API.getLatestAlarmEvent,
        data: {},
        success: (response) => {
          let self = this;
          self.logList = response.data;
        },
      });
    },
  },
  computed: {
    defaultOption() {
      return {
        step: 0.2, // 数值越大速度滚动越快
      };
    },
  },
};
</script>
<style scoped>
* {
  box-sizing: border-box;
}
.newLogBox {
  margin-top: 10px;
  height: 258px;
  overflow: hidden;
}
.newLogHead {
  width: 100%;
  padding: 10px 5px;
  color: #ffffff;
  display: flex;
  text-align: center;
  justify-content: space-between;
  border-bottom: 1px solid #488fff47;
}
.newLogItem {
  /* font-size: 14px; */
  line-height: 20px;
  padding: 11px 0px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  border-radius: 3px;
  color: #ffffff;
  text-align: center;
  font-size: 16px;
  padding: 10px 5px;
}
.logListevent {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
</style>